package com.EAIPClub.UserAuthDataManager.controller;

import com.EAIPClub.UserAuthDataManager.service.UserAuthDataManagerService;
import com.api.POJO.UserAuthDataManager.AllUserAuthDataReturnMsg;
import com.api.POJO.UserAuthDataManager.UserAuthData;
import com.api.POJO.UserAuthDataManager.UserAuthDataManagerReturnMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @Description :用户登录信息管理模块控制层
 * @Author :崔昌赫
 * @Date : 2021/10/20
 */
@RestController
public class UserAuthDataManagerController {

    private UserAuthDataManagerService userAuthDataManagerService;
    @Autowired
    public void setUserAuthDataManagerService(UserAuthDataManagerService userAuthDataManagerService) {
        this.userAuthDataManagerService = userAuthDataManagerService;
    }

    @PostMapping("/users/auth/data/add")
    UserAuthDataManagerReturnMsg addNewUserAuthData(@RequestBody UserAuthData authData){
        return userAuthDataManagerService.addNewUserAuthData(authData);
    }

    @GetMapping("/users/auth/data/get/all")
    AllUserAuthDataReturnMsg getALlUserAuthData(){
        return userAuthDataManagerService.getAllUserAuthData();
    }

    @GetMapping("/users/auth/data/get/uid/{uid}")
    UserAuthDataManagerReturnMsg getUserAuthDataByUid(@PathVariable String uid){
        return userAuthDataManagerService.getUserAuthDataByUid(uid);
    }
    @GetMapping("/users/auth/data/get/token/{token}")
    UserAuthDataManagerReturnMsg getUserAuthDataByToken(@PathVariable String token){
        return userAuthDataManagerService.getUserAuthDataByToken(token);
    }
    @Deprecated
    @GetMapping("/users/auth/data/get/date/{date}")
    UserAuthDataManagerReturnMsg getUserAuthDataByDate(@PathVariable String date){
        return userAuthDataManagerService.getUserAuthDataByDate(date);
    }
    @Deprecated
    @GetMapping("/users/auth/data/get/expiration/{expiration}")
    UserAuthDataManagerReturnMsg getUserAuthDataByExpiration(@PathVariable String expiration){
        return userAuthDataManagerService.getUserAuthDataByExpiration(expiration);
    }

    @PutMapping("/users/auth/data/put/uid/{uid}")
    UserAuthDataManagerReturnMsg updateUserAuthDataByUid(@PathVariable String uid,@RequestBody UserAuthData userAuthData){
        return userAuthDataManagerService.updateUserAuthDataByUid(uid,userAuthData);
    }
    @PutMapping("/users/auth/data/put/token/{token}")
    UserAuthDataManagerReturnMsg updateUserAuthDataByToken(@PathVariable String token,@RequestBody UserAuthData userAuthData){
        return userAuthDataManagerService.updateUserAuthDataByToken(token,userAuthData);
    }
    @Deprecated
    @PutMapping("/users/auth/data/put/date/{date}")
    UserAuthDataManagerReturnMsg updateUserAuthDataByDate(@PathVariable String date,@RequestBody UserAuthData userAuthData){
        return userAuthDataManagerService.updateUserAuthDataByDate(date,userAuthData);
    }
    @Deprecated
    @PutMapping("/users/auth/data/put/expiration/{expiration}")
    UserAuthDataManagerReturnMsg updateUserAuthDataByExpiration(@PathVariable String expiration,@RequestBody UserAuthData userAuthData){
        return userAuthDataManagerService.updateUserAuthDataByExpiration(expiration,userAuthData);
    }

    @DeleteMapping("/users/auth/data/delete/uid/{uid}")
    UserAuthDataManagerReturnMsg deleteUserAuthDataByUid(@PathVariable String uid){
        return userAuthDataManagerService.deleteUserAuthDataByUid(uid);
    }
    @DeleteMapping("/users/auth/data/delete/token/{token}")
    UserAuthDataManagerReturnMsg deleteUserAuthDataByToken(@PathVariable String token){
        return userAuthDataManagerService.deleteUserAuthDataByToken(token);
    }
    @Deprecated
    @DeleteMapping("/users/auth/data/delete/date/{date}")
    UserAuthDataManagerReturnMsg deleteUserAuthDataByDate(@PathVariable String date){
        return userAuthDataManagerService.deleteUserAuthDataByDate(date);
    }
    @Deprecated
    @DeleteMapping("/users/auth/data/delete/expiration/{expiration}")
    UserAuthDataManagerReturnMsg deleteUserAuthDataByExpiration(@PathVariable String expiration){
        return userAuthDataManagerService.getUserAuthDataByExpiration(expiration);
    }
}
